package edu.xjtu.jih.lost;

import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface LostDao {

    List<Lost_item> findLostList(QuerylostDto queryDto);

    @Update("update lf_item set lf_userid = #{lf_userid},lf_name = #{lf_name},lf_kind = #{lf_kind},lf_time = #{lf_time},lf_desc = #{lf_desc} where lf_id=#{lf_id}")
    void updateLostitem(LostDto dto);

    @Delete("delete from lf_item where lf_id = #{lf_id}")
    void deleteLostitem(String lf_id);

    @Select("select lpad(ifnull(max(convert(substring(lf_id,7,3),signed)),0)+1,3,'0')  from lf_item where lf_id like concat(#{prefix},'%')")
    String findLostitemNewNum(String s);

    @Insert("insert into lf_item(lf_id,lf_name,lf_kind,lf_time,lf_desc,lf_userid) values(#{lf_id},#{lf_name},#{lf_kind},#{lf_time},#{lf_desc},#{lf_userid})")
    void insertLostitem(LostDto dto);

    //@Select("select * from lf_item where xxx = '2196113473'")
    //List<Lost_item> findLostList0(String xxx);
}
